{extend name="base" /}
{block name="body"}
<div class="layui-card">
    <div class="layui-card-header">创建课程</div>
    <div class="layui-card-body">
        <form action="{:request()->url()}" class="layui-form" method="post">
            <div class="layui-form-item">
                <label class="layui-form-label">* 班级封面</label>
                <div class="layui-input-block">
                    <input type="text" name="picture" value="{$data.picture|default=''}" autocomplete="off" placeholder="请上传班级封面" class="layui-input">
                    <button type="button" class="layui-btn layui-btn-primary layui-btn-position {$uploadlocation}"><i class="fa fa-file-image-o"></i> 选择图片</button>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">* 班级标题</label>
                <div class="layui-input-block">
                    <input type="text" name="title" value="{$data.title|default=''}" autocomplete="off" placeholder="请输入班级标题" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">* 入班价格</label>
                <div class="layui-input-block">
                    <input type="text" name="price" value="{$data.price|default=''}" autocomplete="off" placeholder="请输入班级价格" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">* 虚拟学员</label>
                <div class="layui-input-block">
                    <input type="text" name="xuni" value="{$data.xuni|default=''}" autocomplete="off" placeholder="为增加课程的热度，可适当增加虚拟学员" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">* 班级有效期</label>
                <div class="layui-input-block">
                    <input type="text" name="youxiaoqi" value="{$data.youxiaoqi|default=''}" autocomplete="off" placeholder="从学员购买日期开始算,单位天" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">* 班级简介</label>
                <div class="layui-input-block">
                    <div id="editor">{$data.brief|default=''}</div>
                    <textarea name="brief" id="brief" style="display:none;">{$data.brief|default=''}</textarea>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-input-block">
                    <button class="layui-btn" lay-filter="*" lay-submit="">保存</button>
                    <button class="layui-btn layui-btn-primary" type="reset">重置</button>
                </div>
            </div>
        </form>
    </div>
</div>
{/block}
{block name="js"}
<script src="__LIBS__/wangeditor/wangEditor.min.js"></script>
<script>
    var E = window.wangEditor;
    var editor = new E('#editor');
    editor.customConfig.onchange = function (html) {
        $('#brief').val(html)
    };
    editor.customConfig.uploadFileName = 'image';
    editor.customConfig.uploadImgServer = '/api/Uploader/wangEditorUp';
    editor.create();
    $('#brief').val(editor.txt.html());
</script>
{/block}
